<template>
  <div class="infoBox">
    <h2 class="title">{{info.title}}</h2>
    <p>
      <span>发布时间:{{info.add_time| dateFormat }}</span>
      <span>点击{{info.click}}次</span>
    </p>
    <div class="infoContent" v-html="info.content"></div>
    <comment :artid= "id"></comment>
  </div>
</template>

<script>
import comment from "../../commentContainer/Comment.vue";
export default {
  data() {
    return {
      id: this.$route.params.id,
      info: {}
    }
  },
  created() {
    this.getNewsInfo();
  },
  methods: {
    getNewsInfo() {
      var url = "api/getnew/" + this.id;
      this.$http.get(url).then(res => {
        if (res.body.status === 0) {
          this.info = res.body.message[0];
        }
      })
    }
  },
  components: { comment }
}
</script>

<style lang="scss" scoped>
.infoBox {
  padding:0 3px;
  .title {
    font-size: 16px;
    line-height: 30px;
  }
}
</style>


